package com.ruoyi.form.service.impl;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.db.mapper.FormInfoProfitMapper;
import com.ruoyi.db.mapper.MemberExtInfoMapper;
import com.ruoyi.market.utils.SysNumberUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.mapper.FormInfoMapper;
import com.ruoyi.db.domain.FormInfo;
import com.ruoyi.form.service.IFormInfoService;
import com.ruoyi.common.core.text.Convert;

import javax.annotation.Resource;

/**
 * 表单推送信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-08-16
 */
@Service
@DataSource(DataSourceType.SLAVE)
public class FormInfoServiceImpl implements IFormInfoService 
{
    @Autowired
    private FormInfoMapper formInfoMapper;

    @Autowired
    MemberExtInfoMapper memberExtInfoMapper;

    @Autowired
    FormInfoProfitMapper formInfoProfitMapper;

    /**
     * 查询表单推送信息
     * 
     * @param id 表单推送信息主键
     * @return 表单推送信息
     */
    @Override
    public FormInfo selectFormInfoById(String id)
    {
        return formInfoMapper.selectFormInfoById(id);
    }

    /**
     * 查询表单推送信息列表
     * 
     * @param formInfo 表单推送信息
     * @return 表单推送信息
     */
    @Override
    public List<FormInfo> selectFormInfoList(FormInfo formInfo)
    {
        return formInfoMapper.selectFormInfoList(formInfo);
    }

    /**
     * 查询表单推送信息列表
     *
     * @param formInfo 表单推送信息
     * @return 表单推送信息
     */
    @Override
    public List<Map<String, Object>> selectFormInfoListMap(FormInfo formInfo)
    {
        return formInfoMapper.selectFormInfoListMap(formInfo);
    }

    /**
     * 新增表单推送信息
     * 
     * @param formInfo 表单推送信息
     * @return 结果
     */
    @Override
    public int insertFormInfo(FormInfo formInfo)
    {
        formInfo.setStatus(0L);
        formInfo.setCreateTime(DateUtils.getNowDate());
        return formInfoMapper.insertFormInfo(formInfo);
    }

    /**
     * 修改表单推送信息
     * 
     * @param formInfo 表单推送信息
     * @return 结果
     */
    @Override
    public int updateFormInfo(FormInfo formInfo)
    {
        return formInfoMapper.updateFormInfo(formInfo);
    }

    /**
     * 批量删除表单推送信息
     * 
     * @param ids 需要删除的表单推送信息主键
     * @return 结果
     */
    @Override
    public int deleteFormInfoByIds(String ids)
    {
        return formInfoMapper.deleteFormInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除表单推送信息信息
     * 
     * @param id 表单推送信息主键
     * @return 结果
     */
    @Override
    public int deleteFormInfoById(String id)
    {
        return formInfoMapper.deleteFormInfoById(id);
    }

    @Override
    public List<Map<String, String>> selectChannelInfoListMap() {
        return formInfoMapper.selectChannelInfoListMap();
    }

}
